﻿<!--#include file="inc/conn.asp"--><%
set rs=server.createobject("adodb.recordset")
id=request("id")
nid=request("nid")
rs.open "select * from comics where id="&request("id"),conn,1,1
if not rs.eof then
id=rs("id")
 comic_name=rs("mhmc")
end if
rs.close
MaxPerPage=15
   if not isempty(request("page")) then 
      currentPage=cint(request("page")) 
   else 
      currentPage=1 
   end if
set rs=server.createobject("adodb.recordset")
rs.open "select * from Reply where CID="&id&"  order by date desc",conn,1,1
allshu=rs.recordcount
%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="/css/main.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/Scripts/ad.js"></script><script language="JavaScript" src="/Scripts/c.js" type="text/javascript"></script>
<title>动漫评论</title>
  <SCRIPT type="text/javascript"> 
  <!-- 
function CutStrLength(str, Ilength) 
{  
var tmp = 0; 
var len = 0; 
var okLen = 0 
for(var i=0;i<Ilength;i++) 
{ 
if(str.charCodeAt(i)>255) 
tmp += 2  
else 
len += 1 
okLen += 1 
if(tmp + len == Ilength)  
{ 
return (str.substring(0,okLen)); 
break; 
} 
if(tmp + len > Ilength) 
{ 
return (str.substring(0,okLen - 1) + " ");  
break; 
} 
} 
} 

function  checkFieldLength(fieldName,fieldDesc,fieldLength   )    
  {      

  var   str   = document.getElementById(fieldName).value;    
  var   theLen=0;    
var   teststr='';    
  for   (i=0;i<str.length;i++)    
  {    
  teststr=str.charAt(i);      
if(str.charCodeAt(i)>255)    
theLen=theLen   +   2;    
else    
  theLen=theLen   +   1;    
  }   
  document.getElementById('showMsg').innerText = theLen; 
 
  if(   theLen>fieldLength   )    
  {   
  document.getElementById('showMsg').innerText = fieldDesc; 
  //alert(fieldDesc+"   的字段长度超过规定长度！");    
  //document.getElementById(fieldName).focus();    
  document.getElementById(fieldName).value = CutStrLength(str, fieldLength); 
  return   false;    
  }    
  else    
  {    
  return   true;    
  }    
  } 
  
  function checkpl()
  {
      if (document.form1.content.value==""){
	      alert("评论不能为空")
		  document.form1.content.focus();
		  return false
		    }
			      if (document.form1.content.value.length < 5){
	      alert("评论字节数不能小于5")
		  document.form1.content.focus();
		  return false
		    }
			      if (document.form1.code.value==""){
	      alert("验证码不能为空")
		  document.form1.code.focus();
		  return false
		    }
		  return true
  }
  //--> 
  </SCRIPT> 
</head>
<body>
		<div class="outer">      <div class="main_bar" style="text-align:center;"><h2><span style="float:right; font-size:12px;font-weight:normal;"><a href="#pl">发布我的评论</a> 本漫画共有<font color=red><%=allshu%></font>条评论&nbsp;</span> <%=comic_name%>网友评论</h2>
		</div>	  <div class="bookList">      <div class="height_4px"></div>    <div class="height_4px"></div> <%if rs.eof then%><%else

rs.pagesize=MaxPerPage 
mpage=rs.pagecount     
rs.move  (currentPage-1)*MaxPerPage
i=0
					do while not rs.eof%> <div style="font-size:12px;color:#2180C0;border-top:2px solid #ccc;padding:5px;"><span class="ctop"><a href="javascript:;" onclick="agree(<%=rs("id")%>,1)" title="强烈支持此楼观点，顶！" id="agree_<%=rs("id")%>_1">支持</a>(<span style="color:blue;font-weight:bold" id="agree_<%=rs("id")%>_1_n"><%=rs("zc")%></span>)&nbsp;<a href="javascript:;" onclick="agree(<%=rs("id")%>,2)" title="坚决不同意此楼观点，反对！" id="agree_<%=rs("id")%>_2">反对</a>(<span style="color:red;font-weight:bold" id="agree_<%=rs("id")%>_2_n"><%=rs("fd")%></span>)&nbsp;<a href="comment.asp?id=<%=id%>&plid=<%=rs("id")%>&page=<%=currentPage%>#pl">回复</a>(<%set rs1=server.createobject("adodb.recordset")
	sql="select count(*) as ooo from reply where nid = '" & rs("id") & "' "
	rs1.open sql,conn,1,1
	ppp=rs1("ooo")
%><font color=green><b><%=ppp%></b></font>)</span><%=rs("username")%> 来自:      <%
hfren=rs("ip")
hfren=left(hfren,instrRev(hfren,"."))&"*"
response.write hfren
adddate=year(rs("date"))&"-"&month(rs("date"))&"-"&day(rs("date"))
%> 发表于<%if date()=adddate then%>&nbsp;今天&nbsp;<%else%>&nbsp;<%=month(rs("date"))%>/<%=day(rs("date"))%>&nbsp;<%end if%>&nbsp;<%=Hour(rs("date"))%>:<%=Minute(rs("date"))%></div>
<%if rs("nid")<>0 then%><%set rs2=server.createobject("adodb.recordset")
rs2.open "select * from Reply where ID="&rs("nid")&"  order by date desc",conn,1,1%><div class="yinyong">引用:<%if rs2.eof then%>原帖已经删除</div><div class="height_4px"></div><%else%><%=rs2("username")%> 来自:      <%
hfren=rs2("ip")
hfren=left(hfren,instrRev(hfren,"."))&"*"
response.write hfren
adddate=year(rs2("date"))&"-"&month(rs2("date"))&"-"&day(rs2("date"))
%> 发表于<%if date()=adddate then%>&nbsp;今天&nbsp;<%else%>&nbsp;<%=month(rs2("date"))%>/<%=day(rs2("date"))%>&nbsp;<%end if%>&nbsp;<%=Hour(rs2("date"))%>:<%=Minute(rs2("date"))%><div class="ycontent"><%=rs2("content")%></div> </div><div class="height_4px"></div><%
		rs2.close
		end if
		end if%>
		<div style="font-size:14px;line-height:22px;padding:5px;"><%=rs("content")%></div>

<% i=i+1 
if i>=MaxPerPage then exit do 
rs.movenext 
loop 
%>
  <%
rs.close%>
  <%end if%><%if mpage>1 then%><div class="height_4px"></div><div class="page"><%pageno=currentPage 
					 if cint(pageno)>1 then%>
        <a href="comment.asp?page=1&id=<%=id%>" title="最前页">首页</a> <%end if%><% if cint(pageno)>1 then%>&nbsp;
        <a href="comment.asp?page=<%=currentPage-1%>&id=<%=id%>" title="上一页">上一页</a>
        <%end if%>
		
		   <%pp=cint(pageno)-2            
  if pp<1 then            
  pp=1            
  end if            
p=0
for pno=pp to mpage
p=p+1
if pno*1=cint(pageno)*1 then%>
        <span><%=pno%></span>
        <%else%>
        <a href="comment.asp?page=<%=pno%>&id=<%=id%>" title="第<%=pno%>页"><%=pno%></a
> 
        <%end if%>
        <%if p>=5 then exit for            
next%>&nbsp;<% if cint(pageno)< mpage then%>
        <a href="comment.asp?page=<%=currentPage+1%>&id=<%=id%>" title="下一页"> 下一页</a>
        <%end if%>&nbsp; <% if cint(pageno)< mpage then%>
        <a href="comment.asp?page=<%=mpage%>&id=<%=id%>" title="最后页"> 末页</a>
        <%end if%><span class="dot"><select name="select" onChange="javascript:window.location.href=this.options[this.selectedIndex].value"><script> var total_page=<%=mpage%>;var cur_page=<%=pageno%>;for (i=1;i<=total_page;i++){  if (i == cur_page) {    document.write("<option selected value=comment.asp?id=<%=id%>&page="+i+">"+i+"</option>");  } else{    document.write("<option  value=comment.asp?id=<%=id%>&page="+i+">"+i+"</option>");  }}</script></select></span></div><%end if%><a name="pl"></a><span style="float:right;margin:0 10px 1px 0;font-weight:bold;">[<a href="/comment.asp?id=<%=id%>" target="_blank" style="font-weight:bold;">查看所有评论</a>]</span><div class="height_4px"></div><%if request("plid")<>"" then%><div class="yinyong">原帖:<%set rs2=server.createobject("adodb.recordset")
rs2.open "select * from Reply where ID="&request("plid")&"  order by date desc",conn,1,1%><div class="ycontent"><%=rs2("content")%></div><div class="yy_del"><a href="comment.asp?id=<%=id%>&page=<%=currentPage%>#pl">[删除引用]</a></div>
        </div><div class="height_4px"></div><%
		rs2.close
		end if%><form action="comment_save.asp" method="post" name="form1" onsubmit="return checkpl()">
		<div class="fbpl">
			<textarea name="content" id="content" class="contentc" onkeyup="checkFieldLength('content', '2000', 2000);" onchange="checkFieldLength('content', '2000', 2000);"></textarea>
			<div class="btn_bar">
			<span>
				<input  type=hidden name="id" value="<%=id%>" /><input  type=hidden name="nid" value="<%=request("plid")%>" />
				网名:<input id="usrname" name="usrname" type="text" class="input w_60" value="" /><input name="anonymous" type="checkbox" id="anonymous" value="1"  />匿名 验证码:<input id="code" name="code" type="text" class="input w_60" value="" /><img src="/code.asp" style="cursor:hand" onClick="this.src='/code.asp';" alt="看不清?点一下" />
				<input type="submit" value="马上发表" class="btnBig">
				</span>
				<em><a id="showMsg">0</a>/2000</em>
			</div>
		</div>
		</form> </div>    </div> 
		
<SCRIPT language=JavaScript>
function f_frameStyleResize(targObj){
 var targWin = targObj.parent.document.all[targObj.name];
 if(targWin != null) {
  var HeightValue = targObj.document.body.scrollHeight
  targWin.style.pixelHeight = HeightValue;
 }
}
function f_iframeResize(){
 bLoadComplete = true; f_frameStyleResize(self);
}
var bLoadComplete = false;
window.onload = f_iframeResize;
</SCRIPT>
</body>
</html>